<!DOCTYPE html>
<html lang="en" class="x-admin-sm" xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="UTF-8">
    <title>关于资金动向明细</title>
    <header th:replace="header::html"></header>
</head>

<body>
<div class="demoTable">
    <div class="layui-fluid">
        <div class="layui-row  layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="startDate" placeholder="请选择开始日期"
                                       name="startDate">
                            </div>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn" data-type="reload">搜索</button>

                        </div>
                    </div>
                    <div class="layui-card-body ">
                        <table class="layui-hide" id="moneyTable" lay-filter="moneyTable" ></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
	<script>
	layui.use('laydate', function () {
		var laydate = layui.laydate;
		//选中后的回调
		laydate.render({
			elem: '#startDate'
			, done: function (value, date) {
			}
		});

	});

	layui.use('table', function () {
		var table = layui.table;

		//第一个实例
		table.render({
			elem: '#moneyTable'
			, url: '/api-front/frontneed/moneyList' //数据接口
			, page: true //开启分页
			, limits: [5]
			, limit: 6
			, cols: [
				[ //表头
					{title:'ID',type:'numbers', align: 'center'}
					, {field: 'sendaccount', title: '支出账号', align: 'center'}
					, {field: 'tips1', title: '姓名', align: 'center'}
					, {field: 'stype', title: '流动类型',  align: 'center'}
					, {field: 'stotalmoney', title: '金额', align: 'center'}
					, {field: 'stime', title: '流动时间', align: 'center'}
					, {field: 'receiveaccount', title: '资金流向', align: 'center'}

				]
			]
		});
		$('.demoTable .layui-btn').on('click', function () {
			alert("6666");
				var type = $(this).data('type');
				if (type == 'reload') {
					//执行重载
					table.reload('moneyTable', {
						page: {
							curr: 1 //重新从第 1 页开始
						}
						, where: {
							startDate: $("#startDate").val()

						}
					});
				}


		});

	});





</script>

</html>